/**
 * response tickdata from  server ,this wil be sent when data no need sampled or real time data
 */
var tickdata = {
    requestId: "xxxxx",
    msgType: "CHART_DATA",
    payload: {
        seriesName: "f5.c1.p",
        dataType: "Ticked",
        data: [{
                x: 5313442975019,
                y: 0.361511383803246
            },
            {
                x: 5313443447383,
                y: 0.732485793622993
            }
        ]
    }
};
 
 
/**
 * response sampleData from  server ,this wil be sent when data need sampled
 */
var sampleData = {
    requestId: "xxxxx",
    msgType: "CHART_DATA",
    payload: {
        seriesName: "f5.c1.p",
        dataType: "Sampled",
        data: [{
            x: 5313442975019,
            open: 0.361511383803246,
            high: 5313442990155,
            low: 0.0992701089783841,
            close: 0.732485793622993
        }]
    }
};
 
/**
 *  response error from server.this will be sent when series has no data or other exception
 */
var errorMsg = {
    requestId: "xxxxx",
    msgType: "Error",
    payload: {
        seriesName: "f5.c1.p",
        errorCode: 1,
        errorMsg: "Missing data for f5.c1.p"
    }
};
 
 
/**
 * response history data startMark from server based on requestId.
 */
var startMark = {
    requestId: "xxxxx",
    msgType: "startMark",
    payload: {
        chartName: "",
        sampleInterval: 60 * 1000, //if <= 0, means it's tickdata
        maxDataPoint: 5000 // optional field
    }
};
 
/**
 * response history data endMark from server based on requestId.
 */
var endMark = {
    requestId: "xxxxx",
    msgType: "endMark",
    payload: {
        chartName: "",
        sampleInterval: 60 * 1000, //if <= 0, means it's tickdata
        maxDataPoint: 5000 // optional field
    }
};
 
 
/**
 *  this is a commander for init chartconfig. whis will be send  from client to server. when first time connected
 */
var chartConfig = {
    command: "config",
    requestId: "xxxxx",
    payload: {
        chartName: 'TestChart',
        chartTitle: "",
        chartType: "line", // line, OHLC
        configSource: "Excel", // Excel ,PTW, Mobile
        parameters: // things that releated to client(like eletrcon), server can ignore this
        {
            frameless: true,
            xpos: 200,
            ypos: 300,
            height: 300,
            width: 400,
        },
        chartOptions: {
            //things related to highchart, like font size, line style , this can be persisted
        },
        dataOptions: {
            startTime: 1552579204000,
            endTime: 1552579204000, // if null, it contains subscribe
            sampleInterval: 60 * 1000, //if <= 0, means it's tickdata
            maxDataPoint: 5000, //this is only for tickData
            businessHour: "9:00-11:00, 13:00-15:30",
        },
        rangeConfigs: [{
            columnNames: ["adjBidPx", "adjMidPx", "adjAskPx"],
            rangeName: "AdjPriceRT2Graph",
            rowNames: ["170303.IB"],
        }],
        queryConfigs: [{
            query: "select filed1, filed2 from whateverData where filter = 'xxxx'",
            xValueField: "messagePublishTime"
        }],
        directionConfigs: [{
            tokens: ["f5.c1.p", "f10.c2", "2*s3m-100100.IB"],
            quarter: "z8,h9,m9",
            ctd: "170007,170007,170007,170004,170004,170004",
            mergestrategy: "Union" //If not use anymore, we can remove this
        }],
    }
};
 
/**
 *  this is a new commander , for this commander ,server side no need clear requestBefore, just send zoomRequestData to client.
 */
var zoomRequest = {
    command: "zoomRequest",
    requestId: "xxxxx",
    payload: {
        chartName: "TestChart",
        dataOptions: {
            startTime: 1552579204000,
            endTime: 1562579204000 // if null, it contains subscribe
        }
    }
};
 
/**
 *  this is a new commander , for this commander ,server side need clear requestBefore, and resend whole data to client.
 * 
 */
var intervalChange = {
    command: "intervalChange",
    requestId: "xxxxx",
    payload: {
        chartName: "TestChart",
        dataOptions: {
            sampleInterval: 60 * 1000, //if <= 0, means it's tickdata
            maxDataPoint: 5000 //this is only for tickData
        }
    }
};